package rollercoaster.commons;



public class Vertex3D {
	private float x;
	private float y;
	private float z;
	
	
	

	public Vertex3D(float x, float y, float z) {
		super();
		this.x = x;
		this.y = y;
		this.z = z;
	}

	public float getX() {
		return x;
	}

	public void setX(float x) {
		this.x = x;
	}

	public float getY() {
		return y;
	}

	public void setY(float y) {
		this.y = y;
	}

	public float getZ() {
		return z;
	}

	public void setZ(float z) {
		this.z = z;
	}
	
	public String toString(){
		return "("+x+","+y+","+z+")";
	}


	public float[] getCoordinates(){
		float[] coord = new float[3];
		coord[0] = this.getX();
		coord[1] = this.getY();
		coord[2] = this.getZ();
		
		return coord;
	}
	
public void setCoordinates(float[] coordinates) throws IndexOutOfBoundsException{
		
		if(coordinates.length != 3)
			throw new IndexOutOfBoundsException();
		else{
			
			this.setX(coordinates[0]);
			this.setY(coordinates[1]);
			this.setZ(coordinates[2]);
		}
	}

	
	
}
